import React from 'react';
import { connect } from 'dva';
import CardC from '../../Barra/comps/cardC';
import styles from './index.less';
import StockOrder from '../../../InvestmentManage/StockOrder/index'; //股票指令
const filterArr = ['BOOKKEEPING_MODE', 'COMMAND_MODE'];

class AddTrade extends React.Component {
  constructor() {
    super();
    this.state = {};
  }

  componentDidMount() {
    console.log(this.props.mode);
  }

  onOk = (e) => {
    console.log('ok', e);
    this.props.addStock();
    // this.props.changePage('1')
  };
  onCancel = () => {
    console.log('onCancel');
    this.props.changePage('1');
  };
  changeFormPage = () => {
    console.log('changeFormPage');
    this.props.changePage('1');
  };

  render() {
    return (
      <div className={styles.BaseInfoForm}>
        <CardC title='添加交易' type='back' showContent={true} titleIsShow={false} changeFormPage={(e) => this.changeFormPage(e)} />
        {/* 内容 */}
        <div className={styles.baseInfo}>
          <StockOrder type={filterArr.includes(this.props.mode) ? '3' : '1'} rehandleSearch={this.onOk} rehandleSearch2={this.onCancel} />
        </div>
      </div>
    );
  }
}

export default AddTrade;
